export function buildtree(list, arr, parentId) {
    list.forEach((item) => {
        if (item.parentId === parentId) {
            var child = {
                ...item,
                children: [],
            };
            buildtree(list, child.children, item.menuId);
            if (child.children.length === 0) {
                delete child.children;
            }
            arr.push(child);
        }
    });
}